//author:kakake
class tsselfpayDao {
    public data = {
        dbConn: TSLobsterAPI.Program.GetDbConn(),
        WorkId: 1
    }

    constructor(workid: number) {
        this.data.WorkId = workid;
    }

    public getPresPaymentInfo(id: number) {
        let strsql = "select * from WPMT_PresPayment where Id=@id";
        return TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, { id: id });
    }

    //更新已支付状态
    public updatePresPayed(Id: number, TranSerNo: string, OrderNo: string,PayMode:number) {

        var strsql = " update WPMT_PresPayment set PayStatus=2,OrderState=2,PayTime=@PayTime,PayMode=@PayMode,OrderNo=@OrderNo,TranSerNo=@TranSerNo where Id=@Id";
        var dbparams = {
            Id: Id,        
            TranSerNo: TranSerNo,
            OrderNo: OrderNo,
            PayTime: TSLobsterAPI.Utils.getCurrTime(null),
            PayMode:PayMode
        }
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, dbparams);
    }

}